//
//  Database.h
//  iOsiris
//
//  Created by bram on 12/16/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

#import <sqlite3.h>
#import "Account.h"
#import "Selection.h"
#import "Course.h"

#define kFilename @"osiris.db"

@interface Database : NSObject {
	sqlite3 *database;
	NSString *writableDB;
}

- (void) dataFilePath;
- (void) initializeDatabase;
- (void) closeDatabase;

- (Account*) getAccountByName:(NSString *)name;
- (NSMutableArray *) getAllPeriods:(NSString *)year;
- (Selection *) getSelectedPeriodForYear:(NSInteger)year: (NSInteger)period;
- (NSMutableArray *) getYears;
- (NSMutableArray *) getPeriods;
- (NSInteger) getPeriodDataId:(NSInteger)year: (NSInteger)period;
- (NSMutableArray *) openCourses:(NSInteger)perioddataid :(NSInteger)userId;
- (void) registerTheCourse:(NSInteger) rowNr;
- (NSMutableArray *) getRegistrations: (NSInteger)userId;
- (int) getOpenRegisterCount:(NSInteger)period: (NSInteger) number: (NSInteger) userId;
- (int) getRegisteredCoursesCount:(NSInteger)period: (NSInteger) number: (NSInteger) userId;

@end
